#!/bin/bash

BASES=`cat /etc/cexpert.d/*`

case "$1" in
    start)
	for base in $BASES; do
	    #LF=`echo $base | awk '{gsub(":|/", "", $0); print $0}'`
	    /usr/bin/cexpert_s $base;
	done
        ;;

    stop)
	for lock in `ls /var/lock/cexpert_*`; do
	    pid=`cat $lock`
	    kill $pid
	    rm $lock
	done
        ;;
    restart)
	/etc/init.d/cexpertd stop
	/etc/init.d/cexpertd start
	;;
    *)
        echo "Usage $0 {start|stop|restart}"
        exit 1

esac
